package com.example.xwadmin.api.config;

import com.example.xwadmin.interceptor.AllowInterceptor;
import com.example.xwadmin.interceptor.JwtInterceptor;
import com.example.xwadmin.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class ApiWebConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new JwtInterceptor()).addPathPatterns("/api/**").order(1);
        registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/api/**").order(2);
        registry.addInterceptor(new AllowInterceptor()).addPathPatterns("/api/**").order(3);
    }
}
